package com.itheima.dao;

import com.itheima.dto.ClazzAndEmpDTO;
import com.itheima.po.*;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClazzMapper {

    List<ClazzAndEmpDTO> selectClazz(@Param("p") SelectClazzParam param);


    @Insert("insert into clazz(name,room,subject,master_id,begin_date,end_date,update_time,create_time) values(#{name},#{room},#{subject},#{masterId},#{beginDate},#{endDate},#{updateTime},#{createTime})")
    int insert(InserClazz clazz);

    @Delete("delete from clazz where id = #{id}")
    int deleteById(Integer id);

    @Select("select id,name,room,subject,master_id,begin_date,end_date,update_time,create_time from clazz where id = #{id}")
    ClazzSelectById selectClazzById(Integer id);

    @Update("update clazz set name = #{name},room = #{room},subject = #{subject},master_id = #{masterId},begin_date = #{beginDate},end_date = #{endDate},update_time = #{updateTime} where id = #{id}")
    int update(UpdateClazz clazz);

    @Select("select id,name,room,begin_date,end_date,master_id,subject,create_time,update_time from clazz")
    List<SelectAllClazz> selectAll();
}
